import requestProxy from '@/utils/request';

const { request } = requestProxy;

// 自定义表单-获取关联表单
export function getLinkForm(params) {
  return request({
    url: 'admin/form/all',
    method: 'get',
    params
  });
}
// 自定义表单-根据表单id获取所有基础字段
export function getLinkFormKey(params) {
  return request({
    url: 'admin/form/all/keyword',
    method: 'get',
    params
  });
}
export function createProcess(data) {
  return request({
    url: '/admin/form/process/create',
    method: 'post',
    data
  });
}
export function editProcess(data) {
  return request({
    url: '/admin/form/process/edit',
    method: 'put',
    data
  });
}

// 自定义表单-删除子表单存储历史
export function deleteSubformHistory(data) {
  return request({
    url: 'admin/form/process/deleteSubformHistory',
    method: 'delete',
    data
  });
}

// 自定义表单-获取子表单历史存储数据
export function getSubformHistory(params) {
  return request({
    url: 'admin/form/process/subformHistory',
    method: 'get',
    params
  });
}

// 获取主管
export function getLeaderByUser(params) {
  return request({
    url: 'admin/user/getLeaderByUser',
    method: 'get',
    params
  });
}

// 获取修改记录
export function getRecords(params) {
  return request({
    url: 'admin/processManagement/auditEdit/recordList',
    method: 'get',
    params
  });
}
// 获取固定表单审批详情历史快照数据
export function getHistoryDetail(params) {
  return request({
    url: '/admin/processManagement/auditEdit/fixFormRecordDetail',
    method: 'get',
    params
  });
}
// 数据同步
export function syncData(data) {
  return request({
    url: '/admin/form/process/syncData',
    method: 'post',
    data
  });
}
// 数据同步
export function getSyncStatus(params) {
  return request({
    url: '/admin/form/process/syncStatus',
    method: 'get',
    params
  });
}
// 快捷回复列表
export function getQuickReplyList(params) {
  return request({
    url: 'admin/processManagement/replyList',
    method: 'get',
    params
  });
}
// 添加快捷回复
export function addQuickReply(data) {
  return request({
    url: 'admin/processManagement/reply/add',
    method: 'post',
    data
  });
}
// 删除快捷回复
export function deleteQuickReply(id) {
  return request({
    url: `admin/processManagement/reply/delete/${id}`,
    method: 'delete'
  });
}

export function closeProcess(data) {
  return request({
    url: '/admin/common/approval/process/close',
    method: 'post',
    data
  });
}
